﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Csla.Xaml;
using Converter;
using System.Resources;
using System.Reflection;
using csla4Skeleton.UI.SL.Reports;
using csla4Skeleton.UI.SL.Reports.BanHang;
using csla4Skeleton.UI.SL.Reports.Kho;
using csla4Skeleton.UI.SL.Reports.MuaHang;
using csla4Skeleton.UI.SL.Reports.NganHang;
using csla4Skeleton.UI.SL.Reports.TienMat;

namespace csla4Skeleton.UI.SL
{
    public partial class KeToanMainPage : UserControl
    {
        public KeToanMainPage()
        {
            LocalizationConverter converter = new LocalizationConverter();
            //converter.LocalResourceManager = new ResourceManager("csla4Skeleton.UI.SL.DanhMuc.DM_BenKetChuyen.Resources", Assembly.GetExecutingAssembly());
            this.Resources.Add("Localization", converter);
            InitializeComponent();
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            Navigator.Current.ContentPlaceholder = this.PlaceHolder;
            Navigator.Current.ProcessInitialNavigation();
            Navigator.Current.Navigate("csla4Skeleton.UI.SL.StartView,csla4Skeleton.UI.SL");
            Navigator.Current.AfterNavigation += new EventHandler(PlaceHolder_AfterNavigation);
            Dispatcher.BeginInvoke(delegate { this.PlaceHolder.Focus(); });
        }

        private void PlaceHolder_AfterNavigation(object sender, EventArgs e) 
        {
            this.scrollViewer.ScrollToTop();
        }

        private void DanhMuc_ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems[0] == DanhMuc_DM_NhaCungCap_ListBoxItem)
            {
                Navigator.Current.Navigate("csla4Skeleton.UI.SL.DanhMuc.DM_NhaCungCap.DM_NhaCungCap_ListView,csla4Skeleton.UI.SL");
            }
        }

        private void Kho_ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems[0] == Kho_PhieuXuatKho_ListBoxItem)
            {
                Navigator.Current.Navigate("csla4Skeleton.UI.SL.NghiepVu.Kho.K_PhieuXuatKho.K_PhieuXuatKho_MainWindow,csla4Skeleton.UI.SL");
            }
        }

        private void BSP_ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems[0] == BSP_BanDichVu_ListBoxItem)
            {
                Navigator.Current.Navigate("csla4Skeleton.UI.SL.NghiepVu.BanSanPham.BSP_BanDichVu.BSP_BanDichVu_MainWindow,csla4Skeleton.UI.SL");
            }
        }  
    }
}
